home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 20 / develop issue 20 code / pict tricks.sea / Pict Tricks / Batch CLUTLess / BatchCLUTs.c < prev    next >
MacBinary  |  1994-10-14  |  10.1 KB  |  [TEXT/MMCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Fri Oct 14 16:36:12 1994, modified Fri Oct 14 16:36:12 1994, creator 'MMCC', type ASCII, 9827 bytes "BatchCLUTs.c" , at 0x26e3 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MMCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 42 61 74 63 68 43 | 4c 55 54 73 2e 63 00 00 |..BatchC|LUTs.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 01 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 26 63 00 | 00 01 7e aa c4 9c 3c aa |.....&c.|..~...<.|
|00000060| c4 9c 3c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..<.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ea 5c 00 00 |........|.....\..|
|00000080| 2f 2f 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |//------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 0d 2f 2f 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--.//---|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 0d 2f 2f | 0d 2f 2f 09 43 6f 64 65 |-----.//|.//.Code|
|000000d0| 20 74 6f 20 73 74 72 69 | 70 20 74 68 65 20 63 6c | to stri|p the cl|
|000000e0| 75 74 73 20 66 72 6f 6d | 20 61 20 66 6f 6c 64 65 |uts from| a folde|
|000000f0| 72 20 6f 66 20 50 49 43 | 54 73 2e 20 53 65 65 20 |r of PIC|Ts. See |
|00000100| 64 65 76 65 6c 6f 70 20 | 69 73 73 75 65 20 32 30 |develop |issue 20|
|00000110| 2c 0d 2f 2f 09 47 72 61 | 70 68 69 63 61 6c 20 54 |,.//.Gra|phical T|
|00000120| 72 75 66 66 6c 65 73 20 | 63 6f 6c 75 6d 6e 2e 0d |ruffles |column..|
|00000130| 2f 2f 0d 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 4d |//...#in|clude "M|
|00000140| 6f 72 65 46 69 6c 65 73 | 45 78 74 72 61 73 2e 68 |oreFiles|Extras.h|
|00000150| 22 0d 23 69 6e 63 6c 75 | 64 65 20 22 41 70 70 49 |".#inclu|de "AppI|
|00000160| 6e 74 65 72 66 61 63 65 | 2e 68 22 09 2f 2f 20 66 |nterface|.h".// f|
|00000170| 6f 72 20 41 70 70 65 6e | 64 53 74 72 33 31 20 70 |or Appen|dStr31 p|
|00000180| 72 6f 74 6f 20 69 6e 20 | 75 74 69 6c 73 2e 63 0d |roto in |utils.c.|
|00000190| 0d 23 64 65 66 69 6e 65 | 09 09 6b 4e 75 6d 46 53 |.#define|..kNumFS|
|000001a0| 53 70 65 63 73 09 09 09 | 32 0d 23 64 65 66 69 6e |Specs...|2.#defin|
|000001b0| 65 20 09 6b 50 49 43 54 | 48 65 61 64 65 72 53 69 |e .kPICT|HeaderSi|
|000001c0| 7a 65 09 09 35 31 32 20 | 2f 2f 20 74 68 65 20 73 |ze..512 |// the s|
|000001d0| 69 7a 65 20 6f 66 20 74 | 68 65 20 68 65 61 64 65 |ize of t|he heade|
|000001e0| 72 20 6f 66 20 61 20 50 | 49 43 54 20 66 69 6c 65 |r of a P|ICT file|
|000001f0| 0d 0d 2f 2f 20 50 72 6f | 74 6f 74 79 70 65 73 0d |..// Pro|totypes.|
|00000200| 4f 53 45 72 72 09 09 09 | 44 6f 42 61 74 63 68 43 |OSErr...|DoBatchC|
|00000210| 6c 75 74 53 74 72 69 70 | 28 76 6f 69 64 29 3b 0d |lutStrip|(void);.|
|00000220| 4f 53 45 72 72 09 09 09 | 53 74 72 69 70 50 49 43 |OSErr...|StripPIC|
|00000230| 54 46 69 6c 65 28 46 53 | 53 70 65 63 20 2a 70 69 |TFile(FS|Spec *pi|
|00000240| 63 74 46 69 6c 65 53 70 | 65 63 2c 20 46 53 53 70 |ctFileSp|ec, FSSp|
|00000250| 65 63 20 2a 74 61 72 67 | 65 74 44 69 72 53 70 65 |ec *targ|etDirSpe|
|00000260| 63 29 3b 0d 4f 53 45 72 | 72 09 09 09 53 61 76 65 |c);.OSEr|r...Save|
|00000270| 4e 65 77 50 69 63 74 28 | 50 69 63 48 61 6e 64 6c |NewPict(|PicHandl|
|00000280| 65 20 6e 65 77 50 69 63 | 74 2c 20 46 53 53 70 65 |e newPic|t, FSSpe|
|00000290| 63 20 2a 70 69 63 74 46 | 69 6c 65 53 70 65 63 2c |c *pictF|ileSpec,|
|000002a0| 0d 09 09 09 09 09 09 09 | 09 46 53 53 70 65 63 20 |........|.FSSpec |
|000002b0| 2a 74 61 72 67 65 74 44 | 69 72 53 70 65 63 29 3b |*targetD|irSpec);|
|000002c0| 0d 0d 42 6f 6f 6c 65 61 | 6e 20 09 09 43 75 73 74 |..Boolea|n ..Cust|
|000002d0| 6f 6d 47 65 74 28 46 53 | 53 70 65 63 20 2a 66 53 |omGet(FS|Spec *fS|
|000002e0| 70 65 63 29 3b 0d 70 61 | 73 63 61 6c 20 76 6f 69 |pec);.pa|scal voi|
|000002f0| 64 20 09 53 74 72 69 70 | 43 6c 75 74 50 72 6f 63 |d .Strip|ClutProc|
|00000300| 28 42 69 74 4d 61 70 20 | 2a 73 72 63 2c 20 0d 09 |(BitMap |*src, ..|
|00000310| 09 09 09 09 09 09 09 52 | 65 63 74 20 2a 73 72 63 |.......R|ect *src|
|00000320| 52 2c 20 52 65 63 74 20 | 2a 64 73 74 52 2c 0d 09 |R, Rect |*dstR,..|
|00000330| 09 09 09 09 09 09 09 73 | 68 6f 72 74 20 6d 6f 64 |.......s|hort mod|
|00000340| 65 2c 20 52 67 6e 48 61 | 6e 64 6c 65 20 6d 73 6b |e, RgnHa|ndle msk|
|00000350| 29 3b 0d 09 09 09 09 09 | 09 09 09 0d 70 61 73 63 |);......|....pasc|
|00000360| 61 6c 09 4f 53 45 72 72 | 09 47 65 74 54 79 70 65 |al.OSErr|.GetType|
|00000370| 64 46 69 6c 65 73 49 6e | 44 69 72 28 73 68 6f 72 |dFilesIn|Dir(shor|
|00000380| 74 20 76 52 65 66 4e 75 | 6d 2c 0d 09 09 09 09 09 |t vRefNu|m,......|
|00000390| 09 09 6c 6f 6e 67 20 64 | 69 72 49 44 2c 0d 09 09 |..long d|irID,...|
|000003a0| 09 09 09 09 09 53 74 72 | 69 6e 67 50 74 72 20 6e |.....Str|ingPtr n|
|000003b0| 61 6d 65 2c 0d 09 09 09 | 09 09 09 09 4f 53 54 79 |ame,....|....OSTy|
|000003c0| 70 65 09 66 69 6c 65 54 | 79 70 65 2c 0d 09 09 09 |pe.fileT|ype,....|
|000003d0| 09 09 09 09 46 53 53 70 | 65 63 50 74 72 20 69 74 |....FSSp|ecPtr it|
|000003e0| 65 6d 73 2c 0d 09 09 09 | 09 09 09 09 73 68 6f 72 |ems,....|....shor|
|000003f0| 74 20 72 65 71 49 74 65 | 6d 43 6f 75 6e 74 2c 0d |t reqIte|mCount,.|
|00000400| 09 09 09 09 09 09 09 73 | 68 6f 72 74 20 2a 61 63 |.......s|hort *ac|
|00000410| 74 49 74 65 6d 43 6f 75 | 6e 74 2c 0d 09 09 09 09 |tItemCou|nt,.....|
|00000420| 09 09 09 73 68 6f 72 74 | 20 2a 69 74 65 6d 49 6e |...short| *itemIn|
|00000430| 64 65 78 29 3b 0d 0d 2f | 2f 20 47 6c 6f 62 61 6c |dex);../|/ Global|
|00000440| 73 0d 43 51 44 50 72 6f | 63 73 09 73 74 72 69 70 |s.CQDPro|cs.strip|
|00000450| 43 6c 75 74 50 72 6f 63 | 73 3b 20 2f 2f 20 53 65 |ClutProc|s; // Se|
|00000460| 74 20 6f 66 20 51 44 50 | 72 6f 63 73 20 74 68 61 |t of QDP|rocs tha|
|00000470| 74 20 69 6e 63 6c 75 64 | 65 73 20 6f 75 72 20 63 |t includ|es our c|
|00000480| 75 73 74 6f 6d 20 62 69 | 74 73 50 72 6f 63 0d 42 |ustom bi|tsProc.B|
|00000490| 6f 6f 6c 65 61 6e 09 09 | 67 43 6c 75 74 53 74 72 |oolean..|gClutStr|
|000004a0| 69 70 70 65 64 3b 09 2f | 2f 20 53 65 74 20 62 79 |ipped;./|/ Set by|
|000004b0| 20 74 68 65 20 62 69 74 | 73 50 72 6f 63 20 74 6f | the bit|sProc to|
|000004c0| 20 69 6e 64 69 63 61 74 | 65 20 69 66 20 74 68 65 | indicat|e if the|
|000004d0| 20 63 6c 75 74 20 77 61 | 73 20 72 65 6d 6f 76 65 | clut wa|s remove|
|000004e0| 64 0d 0d 65 78 74 65 72 | 6e 20 57 69 6e 64 6f 77 |d..exter|n Window|
|000004f0| 50 74 72 20 09 67 57 69 | 6e 64 6f 77 3b 20 2f 2f |Ptr .gWi|ndow; //|
|00000500| 20 54 68 65 20 6f 6e 65 | 20 61 6e 64 20 6f 6e 6c | The one| and onl|
|00000510| 79 20 77 69 6e 64 6f 77 | 20 28 67 61 67 29 0d 0d |y window| (gag)..|
|00000520| 2f 2f 20 53 65 61 72 63 | 68 20 72 65 63 75 72 73 |// Searc|h recurs|
|00000530| 69 76 65 6c 79 20 74 68 | 72 6f 75 67 68 20 61 6c |ively th|rough al|
|00000540| 6c 20 74 68 65 20 66 69 | 6c 65 73 20 69 6e 20 61 |l the fi|les in a|
|00000550| 20 64 69 72 65 63 74 6f | 72 79 2c 20 73 74 72 69 | directo|ry, stri|
|00000560| 70 20 74 68 65 20 63 6c | 75 74 20 66 72 6f 6d 20 |p the cl|ut from |
|00000570| 0d 2f 2f 20 65 76 65 72 | 79 20 50 49 43 54 20 66 |.// ever|y PICT f|
|00000580| 69 6c 65 20 74 68 61 74 | 20 68 61 73 20 6f 6e 65 |ile that| has one|
|00000590| 0d 4f 53 45 72 72 20 44 | 6f 42 61 74 63 68 43 6c |.OSErr D|oBatchCl|
|000005a0| 75 74 53 74 72 69 70 28 | 76 6f 69 64 29 0d 7b 0d |utStrip(|void).{.|
|000005b0| 09 46 53 53 70 65 63 09 | 09 64 69 72 53 70 65 63 |.FSSpec.|.dirSpec|
|000005c0| 2c 20 6e 65 77 44 69 72 | 53 70 65 63 2c 20 66 69 |, newDir|Spec, fi|
|000005d0| 6c 65 53 70 65 63 73 5b | 6b 4e 75 6d 46 53 53 70 |leSpecs[|kNumFSSp|
|000005e0| 65 63 73 5d 3b 0d 09 42 | 6f 6f 6c 65 61 6e 09 09 |ecs];..B|oolean..|
|000005f0| 67 6f 6f 64 53 65 6c 65 | 63 74 69 6f 6e 3b 0d 09 |goodSele|ction;..|
|00000600| 73 68 6f 72 74 09 09 61 | 63 74 49 74 65 6d 43 6f |short..a|ctItemCo|
|00000610| 75 6e 74 2c 20 69 74 65 | 6d 49 6e 64 65 78 3b 0d |unt, ite|mIndex;.|
|00000620| 09 6c 6f 6e 67 09 09 6e | 65 77 44 69 72 49 44 2c |.long..n|ewDirID,|
|00000630| 20 69 3b 0d 09 4f 53 45 | 72 72 09 09 65 72 72 3b | i;..OSE|rr..err;|
|00000640| 0d 09 0d 09 2f 2f 20 53 | 65 6c 65 63 74 20 64 69 |....// S|elect di|
|00000650| 72 65 63 74 6f 72 79 0d | 09 67 6f 6f 64 53 65 6c |rectory.|.goodSel|
|00000660| 65 63 74 69 6f 6e 20 3d | 20 43 75 73 74 6f 6d 47 |ection =| CustomG|
|00000670| 65 74 28 26 64 69 72 53 | 70 65 63 29 3b 0d 09 69 |et(&dirS|pec);..i|
|00000680| 66 28 67 6f 6f 64 53 65 | 6c 65 63 74 69 6f 6e 20 |f(goodSe|lection |
|00000690| 3d 3d 20 66 61 6c 73 65 | 29 20 2f 2f 20 55 73 65 |== false|) // Use|
|000006a0| 72 20 63 61 6e 63 65 6c | 65 64 0d 09 7b 0d 09 09 |r cancel|ed..{...|
|000006b0| 53 79 73 42 65 65 70 28 | 31 30 29 3b 0d 09 09 72 |SysBeep(|10);...r|
|000006c0| 65 74 75 72 6e 20 6e 6f | 45 72 72 3b 0d 09 7d 0d |eturn no|Err;..}.|
|000006d0| 09 0d 09 2f 2f 20 43 72 | 65 61 74 65 20 6e 65 77 |...// Cr|eate new|
|000006e0| 20 64 69 72 65 63 74 6f | 72 79 20 66 6f 72 20 6d | directo|ry for m|
|000006f0| 6f 64 69 66 69 65 64 20 | 50 49 43 54 73 0d 09 6e |odified |PICTs..n|
|00000700| 65 77 44 69 72 53 70 65 | 63 20 3d 20 64 69 72 53 |ewDirSpe|c = dirS|
|00000710| 70 65 63 3b 0d 09 41 70 | 70 65 6e 64 53 74 72 33 |pec;..Ap|pendStr3|
|00000720| 31 28 6e 65 77 44 69 72 | 53 70 65 63 2e 6e 61 6d |1(newDir|Spec.nam|
|00000730| 65 2c 20 22 5c 70 2e 73 | 74 72 69 70 70 65 64 22 |e, "\p.s|tripped"|
|00000740| 29 3b 20 0d 09 65 72 72 | 20 3d 20 46 53 70 44 69 |); ..err| = FSpDi|
|00000750| 72 43 72 65 61 74 65 28 | 26 6e 65 77 44 69 72 53 |rCreate(|&newDirS|
|00000760| 70 65 63 2c 20 73 6d 43 | 75 72 72 65 6e 74 53 63 |pec, smC|urrentSc|
|00000770| 72 69 70 74 2c 20 26 6e | 65 77 44 69 72 49 44 29 |ript, &n|ewDirID)|
|00000780| 3b 0d 09 0d 09 2f 2f 20 | 49 66 20 74 68 65 20 64 |;....// |If the d|
|00000790| 69 72 65 63 74 6f 72 79 | 20 65 78 69 73 74 73 20 |irectory| exists |
|000007a0| 61 6c 72 65 61 64 79 2c | 20 65 6d 70 74 79 20 69 |already,| empty i|
|000007b0| 74 0d 09 69 66 28 65 72 | 72 20 3d 3d 20 64 75 70 |t..if(er|r == dup|
|000007c0| 46 4e 45 72 72 29 0d 09 | 7b 0d 09 09 65 72 72 20 |FNErr)..|{...err |
|000007d0| 3d 20 44 65 6c 65 74 65 | 44 69 72 65 63 74 6f 72 |= Delete|Director|
|000007e0| 79 43 6f 6e 74 65 6e 74 | 73 28 6e 65 77 44 69 72 |yContent|s(newDir|
|000007f0| 53 70 65 63 2e 76 52 65 | 66 4e 75 6d 2c 20 6e 65 |Spec.vRe|fNum, ne|
|00000800| 77 44 69 72 53 70 65 63 | 2e 70 61 72 49 44 2c 20 |wDirSpec|.parID, |
|00000810| 6e 65 77 44 69 72 53 70 | 65 63 2e 6e 61 6d 65 29 |newDirSp|ec.name)|
|00000820| 3b 0d 09 7d 0d 09 0d 09 | 69 66 28 65 72 72 20 21 |;..}....|if(err !|
|00000830| 3d 20 6e 6f 45 72 72 29 | 0d 09 7b 0d 09 09 53 79 |= noErr)|..{...Sy|
|00000840| 73 42 65 65 70 28 31 30 | 29 3b 0d 09 09 72 65 74 |sBeep(10|);...ret|
|00000850| 75 72 6e 20 65 72 72 3b | 0d 09 7d 0d 09 0d 09 2f |urn err;|..}..../|
|00000860| 2f 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 6f 75 72 |/ Initia|lize our|
|00000870| 20 62 6f 74 74 6c 65 6e | 65 63 6b 73 20 74 6f 20 | bottlen|ecks to |
|00000880| 73 74 72 69 70 20 63 6c | 75 74 73 0d 09 53 65 74 |strip cl|uts..Set|
|00000890| 53 74 64 43 50 72 6f 63 | 73 28 26 73 74 72 69 70 |StdCProc|s(&strip|
|000008a0| 43 6c 75 74 50 72 6f 63 | 73 29 3b 09 2f 2f 20 64 |ClutProc|s);.// d|
|000008b0| 65 66 61 75 6c 74 20 70 | 72 6f 63 73 0d 09 73 74 |efault p|rocs..st|
|000008c0| 72 69 70 43 6c 75 74 50 | 72 6f 63 73 2e 62 69 74 |ripClutP|rocs.bit|
|000008d0| 73 50 72 6f 63 20 3d 20 | 4e 65 77 51 44 42 69 74 |sProc = |NewQDBit|
|000008e0| 73 50 72 6f 63 28 53 74 | 72 69 70 43 6c 75 74 50 |sProc(St|ripClutP|
|000008f0| 72 6f 63 29 3b 0d 09 0d | 09 2f 2f 20 53 68 6f 77 |roc);...|.// Show|
|00000900| 20 74 68 65 20 77 69 6e | 64 6f 77 0d 09 53 68 6f | the win|dow..Sho|
|00000910| 77 57 69 6e 64 6f 77 28 | 67 57 69 6e 64 6f 77 29 |wWindow(|gWindow)|
|00000920| 3b 0d 09 53 65 74 50 6f | 72 74 28 67 57 69 6e 64 |;..SetPo|rt(gWind|
|00000930| 6f 77 29 3b 0d 09 0d 09 | 2f 2f 20 50 72 6f 63 65 |ow);....|// Proce|
|00000940| 73 73 20 61 6c 6c 20 50 | 49 43 54 73 20 69 6e 20 |ss all P|ICTs in |
|00000950| 64 69 72 65 63 74 6f 72 | 79 0d 09 69 74 65 6d 49 |director|y..itemI|
|00000960| 6e 64 65 78 20 3d 20 31 | 3b 0d 09 77 68 69 6c 65 |ndex = 1|;..while|
|00000970| 28 74 72 75 65 29 0d 09 | 7b 0d 09 09 2f 2f 20 47 |(true)..|{...// G|
|00000980| 65 74 20 61 6c 6c 20 74 | 68 65 20 50 49 43 54 20 |et all t|he PICT |
|00000990| 66 69 6c 65 73 20 69 6e | 20 74 68 65 20 64 69 72 |files in| the dir|
|000009a0| 65 63 74 6f 72 79 2c 20 | 75 70 20 74 6f 20 6b 4e |ectory, |up to kN|
|000009b0| 75 6d 46 53 53 70 65 63 | 73 0d 09 09 47 65 74 54 |umFSSpec|s...GetT|
|000009c0| 79 70 65 64 46 69 6c 65 | 73 49 6e 44 69 72 28 64 |ypedFile|sInDir(d|
|000009d0| 69 72 53 70 65 63 2e 76 | 52 65 66 4e 75 6d 2c 20 |irSpec.v|RefNum, |
|000009e0| 64 69 72 53 70 65 63 2e | 70 61 72 49 44 2c 20 64 |dirSpec.|parID, d|
|000009f0| 69 72 53 70 65 63 2e 6e | 61 6d 65 2c 20 27 50 49 |irSpec.n|ame, 'PI|
|00000a00| 43 54 27 2c 0d 09 09 09 | 09 09 66 69 6c 65 53 70 |CT',....|..fileSp|
|00000a10| 65 63 73 2c 20 6b 4e 75 | 6d 46 53 53 70 65 63 73 |ecs, kNu|mFSSpecs|
|00000a20| 2c 20 26 61 63 74 49 74 | 65 6d 43 6f 75 6e 74 2c |, &actIt|emCount,|
|00000a30| 20 26 69 74 65 6d 49 6e | 64 65 78 29 3b 0d 09 09 | &itemIn|dex);...|
|00000a40| 0d 09 09 2f 2f 20 46 6f | 72 20 65 61 63 68 20 50 |...// Fo|r each P|
|00000a50| 49 43 54 09 09 09 0d 09 | 09 66 6f 72 28 69 20 3d |ICT.....|.for(i =|
|00000a60| 20 30 3b 20 69 20 3c 20 | 61 63 74 49 74 65 6d 43 | 0; i < |actItemC|
|00000a70| 6f 75 6e 74 3b 20 69 2b | 2b 29 0d 09 09 7b 0d 09 |ount; i+|+)...{..|
|00000a80| 09 09 2f 2f 20 4f 70 65 | 6e 20 50 49 43 54 2c 20 |..// Ope|n PICT, |
|00000a90| 73 74 72 69 70 20 63 6c | 75 74 2c 20 73 61 76 65 |strip cl|ut, save|
|00000aa0| 20 6e 65 77 20 76 65 72 | 73 69 6f 6e 0d 09 09 09 | new ver|sion....|
|00000ab0| 65 72 72 20 3d 20 53 74 | 72 69 70 50 49 43 54 46 |err = St|ripPICTF|
|00000ac0| 69 6c 65 28 26 66 69 6c | 65 53 70 65 63 73 5b 69 |ile(&fil|eSpecs[i|
|00000ad0| 5d 2c 20 26 6e 65 77 44 | 69 72 53 70 65 63 29 3b |], &newD|irSpec);|
|00000ae0| 0d 09 09 09 69 66 28 65 | 72 72 20 21 3d 20 6e 6f |....if(e|rr != no|
|00000af0| 45 72 72 29 0d 09 09 09 | 7b 0d 09 09 09 09 2f 2f |Err)....|{.....//|
|00000b00| 20 45 72 72 6f 72 2c 20 | 6c 65 74 27 73 20 63 6c | Error, |let's cl|
|00000b10| 65 61 6e 20 75 70 20 61 | 6e 64 20 72 65 74 75 72 |ean up a|nd retur|
|00000b20| 6e 0d 09 09 09 09 44 65 | 6c 65 74 65 44 69 72 65 |n.....De|leteDire|
|00000b30| 63 74 6f 72 79 28 6e 65 | 77 44 69 72 53 70 65 63 |ctory(ne|wDirSpec|
|00000b40| 2e 76 52 65 66 4e 75 6d | 2c 20 6e 65 77 44 69 72 |.vRefNum|, newDir|
|00000b50| 53 70 65 63 2e 70 61 72 | 49 44 2c 20 6e 65 77 44 |Spec.par|ID, newD|
|00000b60| 69 72 53 70 65 63 2e 6e | 61 6d 65 29 3b 0d 09 09 |irSpec.n|ame);...|
|00000b70| 09 09 72 65 74 75 72 6e | 20 65 72 72 3b 0d 09 09 |..return| err;...|
|00000b80| 09 7d 0d 09 09 7d 0d 09 | 09 0d 09 09 69 66 28 61 |.}...}..|....if(a|
|00000b90| 63 74 49 74 65 6d 43 6f | 75 6e 74 20 3c 20 6b 4e |ctItemCo|unt < kN|
|00000ba0| 75 6d 46 53 53 70 65 63 | 73 29 20 2f 2f 20 77 65 |umFSSpec|s) // we|
|00000bb0| 27 72 65 20 64 6f 6e 65 | 0d 09 09 09 62 72 65 61 |'re done|....brea|
|00000bc0| 6b 3b 0d 09 7d 0d 09 0d | 09 2f 2f 20 48 69 64 65 |k;..}...|.// Hide|
|00000bd0| 20 77 69 6e 64 6f 77 20 | 61 67 61 69 6e 0d 09 48 | window |again..H|
|00000be0| 69 64 65 57 69 6e 64 6f | 77 28 67 57 69 6e 64 6f |ideWindo|w(gWindo|
|00000bf0| 77 29 3b 0d 09 0d 09 2f | 2f 20 42 65 65 70 0d 09 |w);..../|/ Beep..|
|00000c00| 53 79 73 42 65 65 70 28 | 31 30 29 3b 0d 09 0d 09 |SysBeep(|10);....|
|00000c10| 72 65 74 75 72 6e 20 6e | 6f 45 72 72 3b 0d 7d 0d |return n|oErr;.}.|
|00000c20| 0d 4f 53 45 72 72 20 53 | 74 72 69 70 50 49 43 54 |.OSErr S|tripPICT|
|00000c30| 46 69 6c 65 28 46 53 53 | 70 65 63 20 2a 70 69 63 |File(FSS|pec *pic|
|00000c40| 74 46 69 6c 65 53 70 65 | 63 2c 20 46 53 53 70 65 |tFileSpe|c, FSSpe|
|00000c50| 63 20 2a 74 61 72 67 65 | 74 44 69 72 53 70 65 63 |c *targe|tDirSpec|
|00000c60| 29 0d 7b 0d 09 4f 53 45 | 72 72 09 09 65 72 72 20 |).{..OSE|rr..err |
|00000c70| 3d 20 6e 6f 45 72 72 3b | 0d 09 50 69 63 48 61 6e |= noErr;|..PicHan|
|00000c80| 64 6c 65 09 6f 6c 64 50 | 69 63 74 2c 20 6e 65 77 |dle.oldP|ict, new|
|00000c90| 50 69 63 74 3b 0d 09 52 | 65 63 74 09 09 70 69 63 |Pict;..R|ect..pic|
|00000ca0| 74 52 65 63 74 3b 0d 09 | 73 68 6f 72 74 09 09 72 |tRect;..|short..r|
|00000cb0| 65 66 4e 75 6d 3b 0d 09 | 6c 6f 6e 67 09 09 70 69 |efNum;..|long..pi|
|00000cc0| 63 74 53 69 7a 65 3b 0d | 09 0d 09 2f 2f 20 4f 70 |ctSize;.|...// Op|
|00000cd0| 65 6e 20 66 69 6c 65 0d | 09 65 72 72 20 3d 20 46 |en file.|.err = F|
|00000ce0| 53 70 4f 70 65 6e 44 46 | 28 70 69 63 74 46 69 6c |SpOpenDF|(pictFil|
|00000cf0| 65 53 70 65 63 2c 20 66 | 73 52 64 50 65 72 6d 2c |eSpec, f|sRdPerm,|
|00000d00| 20 26 72 65 66 4e 75 6d | 29 3b 0d 09 69 66 28 65 | &refNum|);..if(e|
|00000d10| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 0d 09 7b 0d |rr == no|Err)..{.|
|00000d20| 09 09 2f 2f 20 47 65 74 | 20 74 68 65 20 73 69 7a |..// Get| the siz|
|00000d30| 65 20 6f 66 20 74 68 65 | 20 64 61 74 61 20 69 6e |e of the| data in|
|00000d40| 20 74 68 65 20 66 69 6c | 65 0d 09 09 65 72 72 20 | the fil|e...err |
|00000d50| 3d 20 47 65 74 45 4f 46 | 28 72 65 66 4e 75 6d 2c |= GetEOF|(refNum,|
|00000d60| 20 26 70 69 63 74 53 69 | 7a 65 29 3b 0d 09 09 69 | &pictSi|ze);...i|
|00000d70| 66 28 65 72 72 20 3d 3d | 20 6e 6f 45 72 72 29 0d |f(err ==| noErr).|
|00000d80| 09 09 7b 0d 09 09 09 2f | 2f 20 73 75 62 74 72 61 |..{..../|/ subtra|
|00000d90| 63 74 20 73 74 61 6e 64 | 61 72 64 20 50 49 43 54 |ct stand|ard PICT|
|00000da0| 20 68 65 61 64 65 72 20 | 6c 65 6e 67 74 68 0d 09 | header |length..|
|00000db0| 09 09 70 69 63 74 53 69 | 7a 65 20 2d 3d 20 6b 50 |..pictSi|ze -= kP|
|00000dc0| 49 43 54 48 65 61 64 65 | 72 53 69 7a 65 3b 0d 09 |ICTHeade|rSize;..|
|00000dd0| 09 09 0d 09 09 09 2f 2f | 20 54 72 79 20 74 6f 20 |......//| Try to |
|00000de0| 61 6c 6c 6f 63 61 74 65 | 20 61 20 68 61 6e 64 6c |allocate| a handl|
|00000df0| 65 20 62 69 67 20 65 6e | 6f 75 67 68 2c 20 66 69 |e big en|ough, fi|
|00000e00| 72 73 74 20 69 6e 20 74 | 65 6d 70 20 6d 65 6d 2c |rst in t|emp mem,|
|00000e10| 20 74 68 65 6e 20 61 70 | 70 20 6d 65 6d 0d 09 09 | then ap|p mem...|
|00000e20| 09 6f 6c 64 50 69 63 74 | 20 3d 20 28 50 69 63 48 |.oldPict| = (PicH|
|00000e30| 61 6e 64 6c 65 29 54 65 | 6d 70 4e 65 77 48 61 6e |andle)Te|mpNewHan|
|00000e40| 64 6c 65 28 70 69 63 74 | 53 69 7a 65 2c 20 26 65 |dle(pict|Size, &e|
|00000e50| 72 72 29 3b 0d 09 09 09 | 69 66 28 6f 6c 64 50 69 |rr);....|if(oldPi|
|00000e60| 63 74 20 3d 3d 20 6e 69 | 6c 20 7c 7c 20 65 72 72 |ct == ni|l || err|
|00000e70| 20 21 3d 20 6e 6f 45 72 | 72 29 20 2f 2f 20 54 72 | != noEr|r) // Tr|
|00000e80| 79 20 66 6f 72 20 61 70 | 70 20 6d 65 6d 0d 09 09 |y for ap|p mem...|
|00000e90| 09 7b 0d 09 09 09 09 6f | 6c 64 50 69 63 74 20 3d |.{.....o|ldPict =|
|00000ea0| 20 28 50 69 63 48 61 6e | 64 6c 65 29 4e 65 77 48 | (PicHan|dle)NewH|
|00000eb0| 61 6e 64 6c 65 28 70 69 | 63 74 53 69 7a 65 29 3b |andle(pi|ctSize);|
|00000ec0| 0d 09 09 09 09 65 72 72 | 20 3d 20 4d 65 6d 45 72 |.....err| = MemEr|
|00000ed0| 72 6f 72 28 29 3b 0d 09 | 09 09 7d 0d 09 09 09 0d |ror();..|..}.....|
|00000ee0| 09 09 09 2f 2f 20 49 66 | 20 69 74 20 77 6f 72 6b |...// If| it work|
|00000ef0| 65 64 2c 20 72 65 61 64 | 20 69 6e 20 74 68 65 20 |ed, read| in the |
|00000f00| 70 69 63 74 0d 09 09 09 | 69 66 28 6f 6c 64 50 69 |pict....|if(oldPi|
|00000f10| 63 74 20 21 3d 20 6e 69 | 6c 29 0d 09 09 09 7b 0d |ct != ni|l)....{.|
|00000f20| 09 09 09 09 48 4c 6f 63 | 6b 28 28 48 61 6e 64 6c |....HLoc|k((Handl|
|00000f30| 65 29 6f 6c 64 50 69 63 | 74 29 3b 0d 09 09 09 09 |e)oldPic|t);.....|
|00000f40| 0d 09 09 09 09 2f 2f 20 | 53 65 74 20 70 6f 73 69 |.....// |Set posi|
|00000f50| 74 69 6f 6e 20 74 6f 20 | 6a 75 73 74 20 61 66 74 |tion to |just aft|
|00000f60| 65 72 20 74 68 65 20 66 | 69 6c 65 20 68 65 61 64 |er the f|ile head|
|00000f70| 65 72 0d 09 09 09 09 65 | 72 72 20 3d 20 53 65 74 |er.....e|rr = Set|
|00000f80| 46 50 6f 73 28 72 65 66 | 4e 75 6d 2c 20 66 73 46 |FPos(ref|Num, fsF|
|00000f90| 72 6f 6d 53 74 61 72 74 | 2c 20 28 6c 6f 6e 67 29 |romStart|, (long)|
|00000fa0| 6b 50 49 43 54 48 65 61 | 64 65 72 53 69 7a 65 29 |kPICTHea|derSize)|
|00000fb0| 3b 0d 09 09 09 09 69 66 | 28 65 72 72 20 3d 3d 20 |;.....if|(err == |
|00000fc0| 6e 6f 45 72 72 29 0d 09 | 09 09 09 7b 0d 09 09 09 |noErr)..|...{....|
|00000fd0| 09 09 65 72 72 20 3d 20 | 46 53 52 65 61 64 28 72 |..err = |FSRead(r|
|00000fe0| 65 66 4e 75 6d 2c 20 26 | 70 69 63 74 53 69 7a 65 |efNum, &|pictSize|
|00000ff0| 2c 20 2a 6f 6c 64 50 69 | 63 74 29 3b 0d 09 09 09 |, *oldPi|ct);....|
|00001000| 09 09 69 66 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |..if(err| == noEr|
|00001010| 72 29 0d 09 09 09 09 09 | 7b 0d 09 09 09 09 09 09 |r)......|{.......|
|00001020| 2f 2f 20 57 65 20 68 61 | 76 65 20 74 68 65 20 50 |// We ha|ve the P|
|00001030| 49 43 54 20 61 73 20 61 | 20 68 61 6e 64 6c 65 2e |ICT as a| handle.|
|00001040| 20 4e 6f 77 20 6a 75 73 | 74 20 64 72 61 77 20 69 | Now jus|t draw i|
|00001050| 74 0d 09 09 09 09 09 09 | 2f 2f 20 69 6e 74 6f 20 |t.......|// into |
|00001060| 61 20 6e 65 77 20 70 69 | 63 74 75 72 65 0d 09 09 |a new pi|cture...|
|00001070| 09 09 09 09 70 69 63 74 | 52 65 63 74 20 3d 20 28 |....pict|Rect = (|
|00001080| 2a 2a 6f 6c 64 50 69 63 | 74 29 2e 70 69 63 46 72 |**oldPic|t).picFr|
|00001090| 61 6d 65 3b 0d 09 09 09 | 09 09 09 43 6c 69 70 52 |ame;....|...ClipR|
|000010a0| 65 63 74 28 26 70 69 63 | 74 52 65 63 74 29 3b 0d |ect(&pic|tRect);.|
|000010b0| 09 09 09 09 09 09 0d 09 | 09 09 09 09 09 2f 2f 20 |........|.....// |
|000010c0| 49 6e 73 74 61 6c 6c 20 | 63 75 73 74 6f 6d 20 62 |Install |custom b|
|000010d0| 6f 74 74 6c 65 6e 65 63 | 6b 73 20 61 6e 64 20 64 |ottlenec|ks and d|
|000010e0| 72 61 77 20 69 74 2c 20 | 73 74 72 69 70 70 69 6e |raw it, |strippin|
|000010f0| 67 20 63 6c 75 74 0d 09 | 09 09 09 09 09 71 64 2e |g clut..|.....qd.|
|00001100| 74 68 65 50 6f 72 74 2d | 3e 67 72 61 66 50 72 6f |thePort-|>grafPro|
|00001110| 63 73 20 3d 20 28 51 44 | 50 72 6f 63 73 50 74 72 |cs = (QD|ProcsPtr|
|00001120| 29 28 26 73 74 72 69 70 | 43 6c 75 74 50 72 6f 63 |)(&strip|ClutProc|
|00001130| 73 29 3b 0d 09 09 09 09 | 09 09 6e 65 77 50 69 63 |s);.....|..newPic|
|00001140| 74 20 3d 20 4f 70 65 6e | 50 69 63 74 75 72 65 28 |t = Open|Picture(|
|00001150| 26 70 69 63 74 52 65 63 | 74 29 3b 0d 09 09 09 09 |&pictRec|t);.....|
|00001160| 09 09 44 72 61 77 50 69 | 63 74 75 72 65 28 6f 6c |..DrawPi|cture(ol|
|00001170| 64 50 69 63 74 2c 20 26 | 70 69 63 74 52 65 63 74 |dPict, &|pictRect|
|00001180| 29 3b 0d 09 09 09 09 09 | 09 43 6c 6f 73 65 50 69 |);......|.ClosePi|
|00001190| 63 74 75 72 65 28 29 3b | 0d 09 09 09 09 09 09 71 |cture();|.......q|
|000011a0| 64 2e 74 68 65 50 6f 72 | 74 2d 3e 67 72 61 66 50 |d.thePor|t->grafP|
|000011b0| 72 6f 63 73 20 3d 20 6e | 69 6c 3b 0d 09 09 09 09 |rocs = n|il;.....|
|000011c0| 09 09 0d 09 09 09 09 09 | 09 2f 2f 20 43 68 65 63 |........|.// Chec|
|000011d0| 6b 20 66 6f 72 20 65 72 | 72 6f 72 73 3a 20 51 44 |k for er|rors: QD|
|000011e0| 45 72 72 6f 72 28 29 20 | 64 6f 65 73 6e 27 74 20 |Error() |doesn't |
|000011f0| 73 65 65 6d 20 74 6f 20 | 77 6f 72 6b 2c 0d 09 09 |seem to |work,...|
|00001200| 09 09 09 09 2f 2f 20 62 | 75 74 20 49 20 6e 6f 74 |....// b|ut I not|
|00001210| 69 63 65 64 20 70 69 63 | 53 69 7a 65 20 77 61 73 |iced pic|Size was|
|00001220| 20 2d 31 20 77 68 65 6e | 20 69 74 20 64 69 65 64 | -1 when| it died|
|00001230| 20 6f 6e 20 6f 6e 65 20 | 70 69 63 74 75 72 65 2e | on one |picture.|
|00001240| 0d 09 09 09 09 09 09 2f | 2f 20 53 6f 20 77 68 61 |......./|/ So wha|
|00001250| 74 20 74 68 65 20 68 65 | 6c 6c 2e 0d 09 09 09 09 |t the he|ll......|
|00001260| 09 09 69 66 28 51 44 45 | 72 72 6f 72 28 29 20 21 |..if(QDE|rror() !|
|00001270| 3d 20 6e 6f 45 72 72 20 | 7c 7c 20 28 2a 6e 65 77 |= noErr ||| (*new|
|00001280| 50 69 63 74 29 2d 3e 70 | 69 63 53 69 7a 65 20 21 |Pict)->p|icSize !|
|00001290| 3d 20 2d 31 29 0d 09 09 | 09 09 09 09 7b 0d 09 09 |= -1)...|....{...|
|000012a0| 09 09 09 09 09 2f 2f 20 | 43 68 65 63 6b 20 67 6c |.....// |Check gl|
|000012b0| 6f 62 61 6c 20 74 6f 20 | 73 65 65 20 69 66 20 61 |obal to |see if a|
|000012c0| 20 63 6c 75 74 20 77 61 | 73 20 73 74 72 69 70 70 | clut wa|s stripp|
|000012d0| 65 64 0d 09 09 09 09 09 | 09 09 69 66 28 67 43 6c |ed......|..if(gCl|
|000012e0| 75 74 53 74 72 69 70 70 | 65 64 29 0d 09 09 09 09 |utStripp|ed).....|
|000012f0| 09 09 09 7b 09 0d 09 09 | 09 09 09 09 09 09 2f 2f |...{....|......//|
|00001300| 20 44 72 61 77 20 6e 65 | 77 20 70 69 63 74 75 72 | Draw ne|w pictur|
|00001310| 65 20 69 6e 20 77 69 6e | 64 6f 77 0d 09 09 09 09 |e in win|dow.....|
|00001320| 09 09 09 09 44 72 61 77 | 50 69 63 74 75 72 65 28 |....Draw|Picture(|
|00001330| 6e 65 77 50 69 63 74 2c | 20 26 70 69 63 74 52 65 |newPict,| &pictRe|
|00001340| 63 74 29 3b 0d 09 09 09 | 09 09 09 09 09 0d 09 09 |ct);....|........|
|00001350| 09 09 09 09 09 09 2f 2f | 20 53 61 76 65 20 69 6e |......//| Save in|
|00001360| 20 61 20 6e 65 77 20 66 | 69 6c 65 0d 09 09 09 09 | a new f|ile.....|
|00001370| 09 09 09 09 65 72 72 20 | 3d 20 53 61 76 65 4e 65 |....err |= SaveNe|
|00001380| 77 50 69 63 74 28 6e 65 | 77 50 69 63 74 2c 20 70 |wPict(ne|wPict, p|
|00001390| 69 63 74 46 69 6c 65 53 | 70 65 63 2c 20 74 61 72 |ictFileS|pec, tar|
|000013a0| 67 65 74 44 69 72 53 70 | 65 63 29 3b 0d 09 09 09 |getDirSp|ec);....|
|000013b0| 09 09 09 09 09 69 66 28 | 65 72 72 20 21 3d 20 6e |.....if(|err != n|
|000013c0| 6f 45 72 72 29 0d 09 09 | 09 09 09 09 09 09 09 44 |oErr)...|.......D|
|000013d0| 65 62 75 67 53 74 72 28 | 22 5c 70 46 61 69 6c 65 |ebugStr(|"\pFaile|
|000013e0| 64 20 69 6e 20 53 61 76 | 65 4e 65 77 50 69 63 74 |d in Sav|eNewPict|
|000013f0| 2c 20 62 75 74 20 6b 65 | 65 70 20 67 6f 69 6e 67 |, but ke|ep going|
|00001400| 22 29 3b 0d 09 09 09 09 | 09 09 09 7d 0d 09 09 09 |");.....|...}....|
|00001410| 09 09 09 7d 0d 09 09 09 | 09 09 09 4b 69 6c 6c 50 |...}....|...KillP|
|00001420| 69 63 74 75 72 65 28 6e | 65 77 50 69 63 74 29 3b |icture(n|ewPict);|
|00001430| 0d 09 09 09 09 09 7d 0d | 09 09 09 09 7d 0d 09 09 |......}.|....}...|
|00001440| 09 09 44 69 73 70 6f 73 | 48 61 6e 64 6c 65 28 28 |..Dispos|Handle((|
|00001450| 48 61 6e 64 6c 65 29 6f | 6c 64 50 69 63 74 29 3b |Handle)o|ldPict);|
|00001460| 0d 09 09 09 09 6f 6c 64 | 50 69 63 74 20 3d 20 6e |.....old|Pict = n|
|00001470| 69 6c 3b 0d 09 09 09 7d | 0d 09 09 09 65 6c 73 65 |il;....}|....else|
|00001480| 0d 09 09 09 09 44 65 62 | 75 67 53 74 72 28 22 5c |.....Deb|ugStr("\|
|00001490| 70 4f 75 74 20 6f 66 20 | 4d 65 6d 6f 72 79 21 22 |pOut of |Memory!"|
|000014a0| 29 3b 0d 09 09 7d 0d 09 | 09 46 53 43 6c 6f 73 65 |);...}..|.FSClose|
|000014b0| 28 72 65 66 4e 75 6d 29 | 3b 0d 09 7d 0d 09 72 65 |(refNum)|;..}..re|
|000014c0| 74 75 72 6e 20 65 72 72 | 3b 0d 7d 0d 0d 0d 2f 2f |turn err|;.}...//|
|000014d0| 20 53 61 76 65 20 74 68 | 65 20 67 69 76 65 6e 20 | Save th|e given |
|000014e0| 70 69 63 74 75 72 65 20 | 69 6e 74 6f 20 61 20 6e |picture |into a n|
|000014f0| 65 77 20 66 69 6c 65 2c | 20 6c 69 6b 65 20 74 68 |ew file,| like th|
|00001500| 65 20 6f 6c 64 20 6f 6e | 65 20 62 75 74 20 69 6e |e old on|e but in|
|00001510| 20 74 68 65 20 74 61 72 | 67 65 74 20 64 69 72 65 | the tar|get dire|
|00001520| 63 74 6f 72 79 0d 4f 53 | 45 72 72 20 53 61 76 65 |ctory.OS|Err Save|
|00001530| 4e 65 77 50 69 63 74 28 | 50 69 63 48 61 6e 64 6c |NewPict(|PicHandl|
|00001540| 65 20 6e 65 77 50 69 63 | 74 2c 20 46 53 53 70 65 |e newPic|t, FSSpe|
|00001550| 63 20 2a 70 69 63 74 46 | 69 6c 65 53 70 65 63 2c |c *pictF|ileSpec,|
|00001560| 20 46 53 53 70 65 63 20 | 2a 74 61 72 67 65 74 44 | FSSpec |*targetD|
|00001570| 69 72 53 70 65 63 29 0d | 7b 0d 09 4f 53 45 72 72 |irSpec).|{..OSErr|
|00001580| 09 09 65 72 72 3b 0d 09 | 6c 6f 6e 67 09 09 64 69 |..err;..|long..di|
|00001590| 72 49 44 2c 20 77 72 69 | 74 65 53 69 7a 65 3b 0d |rID, wri|teSize;.|
|000015a0| 09 42 6f 6f 6c 65 61 6e | 09 09 69 73 44 69 72 3b |.Boolean|..isDir;|
|000015b0| 0d 09 46 53 53 70 65 63 | 09 09 6e 65 77 50 69 63 |..FSSpec|..newPic|
|000015c0| 74 53 70 65 63 3b 0d 09 | 46 49 6e 66 6f 09 09 69 |tSpec;..|FInfo..i|
|000015d0| 6e 66 6f 3b 0d 09 73 68 | 6f 72 74 09 09 72 65 66 |nfo;..sh|ort..ref|
|000015e0| 4e 75 6d 3b 0d 09 50 74 | 72 09 09 09 7a 65 72 6f |Num;..Pt|r...zero|
|000015f0| 73 3b 0d 09 0d 09 2f 2f | 20 46 69 72 73 74 20 67 |s;....//| First g|
|00001600| 65 74 20 74 68 65 20 61 | 63 74 75 61 6c 20 64 69 |et the a|ctual di|
|00001610| 72 49 44 20 6f 66 20 74 | 68 65 20 64 65 73 74 69 |rID of t|he desti|
|00001620| 6e 61 74 69 6f 6e 20 64 | 69 72 65 63 74 6f 72 79 |nation d|irectory|
|00001630| 0d 09 65 72 72 20 3d 20 | 44 69 72 49 44 46 72 6f |..err = |DirIDFro|
|00001640| 6d 46 53 53 70 65 63 28 | 74 61 72 67 65 74 44 69 |mFSSpec(|targetDi|
|00001650| 72 53 70 65 63 2c 20 26 | 64 69 72 49 44 2c 20 26 |rSpec, &|dirID, &|
|00001660| 69 73 44 69 72 29 3b 0d | 09 69 66 28 65 72 72 20 |isDir);.|.if(err |
|00001670| 3d 3d 20 6e 6f 45 72 72 | 20 26 26 20 69 73 44 69 |== noErr| && isDi|
|00001680| 72 29 0d 09 7b 0d 09 09 | 2f 2f 20 4e 6f 77 20 6d |r)..{...|// Now m|
|00001690| 61 6b 65 20 61 6e 20 46 | 53 53 70 65 63 20 66 6f |ake an F|SSpec fo|
|000016a0| 72 20 74 68 65 20 6e 65 | 77 20 66 69 6c 65 0d 09 |r the ne|w file..|
|000016b0| 09 65 72 72 20 3d 20 46 | 53 4d 61 6b 65 46 53 53 |.err = F|SMakeFSS|
|000016c0| 70 65 63 28 74 61 72 67 | 65 74 44 69 72 53 70 65 |pec(targ|etDirSpe|
|000016d0| 63 2d 3e 76 52 65 66 4e | 75 6d 2c 20 64 69 72 49 |c->vRefN|um, dirI|
|000016e0| 44 2c 20 70 69 63 74 46 | 69 6c 65 53 70 65 63 2d |D, pictF|ileSpec-|
|000016f0| 3e 6e 61 6d 65 2c 0d 09 | 09 09 09 09 09 09 26 6e |>name,..|......&n|
|00001700| 65 77 50 69 63 74 53 70 | 65 63 29 3b 0d 09 09 0d |ewPictSp|ec);....|
|00001710| 09 09 2f 2f 20 53 68 6f | 75 6c 64 20 67 65 74 20 |..// Sho|uld get |
|00001720| 61 6e 20 66 6e 66 45 72 | 72 20 62 61 63 6b 2c 20 |an fnfEr|r back, |
|00001730| 73 69 6e 63 65 20 74 68 | 65 20 66 69 6c 65 20 64 |since th|e file d|
|00001740| 6f 65 73 6e 27 74 20 65 | 78 69 73 74 2e 20 49 66 |oesn't e|xist. If|
|00001750| 20 6e 6f 74 2c 0d 09 09 | 2f 2f 20 64 6f 20 6e 6f | not,...|// do no|
|00001760| 74 68 69 6e 67 0d 09 09 | 69 66 28 65 72 72 20 3d |thing...|if(err =|
|00001770| 3d 20 66 6e 66 45 72 72 | 29 0d 09 09 7b 0d 09 09 |= fnfErr|)...{...|
|00001780| 09 2f 2f 20 47 65 74 20 | 74 68 65 20 46 49 6e 66 |.// Get |the FInf|
|00001790| 6f 20 66 6f 72 20 74 68 | 65 20 6f 6c 64 20 66 69 |o for th|e old fi|
|000017a0| 6c 65 20 73 6f 20 77 65 | 20 63 61 6e 20 75 73 65 |le so we| can use|
|000017b0| 20 74 68 65 20 73 61 6d | 65 20 74 79 70 65 20 61 | the sam|e type a|
|000017c0| 6e 64 20 63 72 65 61 74 | 6f 72 0d 09 09 09 65 72 |nd creat|or....er|
|000017d0| 72 20 3d 20 46 53 70 47 | 65 74 46 49 6e 66 6f 28 |r = FSpG|etFInfo(|
|000017e0| 70 69 63 74 46 69 6c 65 | 53 70 65 63 2c 20 26 69 |pictFile|Spec, &i|
|000017f0| 6e 66 6f 29 3b 0d 09 09 | 09 69 66 28 65 72 72 20 |nfo);...|.if(err |
|00001800| 3d 3d 20 6e 6f 45 72 72 | 29 0d 09 09 09 7b 0d 09 |== noErr|)....{..|
|00001810| 09 09 09 2f 2f 20 4d 61 | 6b 65 20 74 68 65 20 6e |...// Ma|ke the n|
|00001820| 65 77 20 66 69 6c 65 0d | 09 09 09 09 65 72 72 20 |ew file.|....err |
|00001830| 3d 20 46 53 70 43 72 65 | 61 74 65 28 26 6e 65 77 |= FSpCre|ate(&new|
|00001840| 50 69 63 74 53 70 65 63 | 2c 20 69 6e 66 6f 2e 66 |PictSpec|, info.f|
|00001850| 64 43 72 65 61 74 6f 72 | 2c 20 69 6e 66 6f 2e 66 |dCreator|, info.f|
|00001860| 64 54 79 70 65 2c 0d 09 | 09 09 09 09 09 09 09 09 |dType,..|........|
|00001870| 73 6d 43 75 72 72 65 6e | 74 53 63 72 69 70 74 29 |smCurren|tScript)|
|00001880| 3b 0d 09 09 09 09 69 66 | 28 65 72 72 20 3d 3d 20 |;.....if|(err == |
|00001890| 6e 6f 45 72 72 29 0d 09 | 09 09 09 7b 0d 09 09 09 |noErr)..|...{....|
|000018a0| 09 09 2f 2f 20 4f 70 65 | 6e 20 69 74 0d 09 09 09 |..// Ope|n it....|
|000018b0| 09 09 65 72 72 20 3d 20 | 46 53 70 4f 70 65 6e 44 |..err = |FSpOpenD|
|000018c0| 46 28 26 6e 65 77 50 69 | 63 74 53 70 65 63 2c 20 |F(&newPi|ctSpec, |
|000018d0| 66 73 57 72 50 65 72 6d | 2c 20 26 72 65 66 4e 75 |fsWrPerm|, &refNu|
|000018e0| 6d 29 3b 0d 09 09 09 09 | 09 69 66 28 65 72 72 20 |m);.....|.if(err |
|000018f0| 3d 3d 20 6e 6f 45 72 72 | 29 0d 09 09 09 09 09 7b |== noErr|)......{|
|00001900| 0d 09 09 09 09 09 09 2f | 2f 20 57 72 69 74 65 20 |......./|/ Write |
|00001910| 6f 75 74 20 7a 65 72 6f | 73 20 66 6f 72 20 68 65 |out zero|s for he|
|00001920| 61 64 65 72 20 62 79 74 | 65 73 0d 09 09 09 09 09 |ader byt|es......|
|00001930| 09 77 72 69 74 65 53 69 | 7a 65 20 3d 20 6b 50 49 |.writeSi|ze = kPI|
|00001940| 43 54 48 65 61 64 65 72 | 53 69 7a 65 3b 0d 09 09 |CTHeader|Size;...|
|00001950| 09 09 09 09 7a 65 72 6f | 73 20 3d 20 4e 65 77 50 |....zero|s = NewP|
|00001960| 74 72 43 6c 65 61 72 28 | 77 72 69 74 65 53 69 7a |trClear(|writeSiz|
|00001970| 65 29 3b 0d 09 09 09 09 | 09 09 69 66 28 7a 65 72 |e);.....|..if(zer|
|00001980| 6f 73 20 21 3d 20 6e 69 | 6c 29 0d 09 09 09 09 09 |os != ni|l)......|
|00001990| 09 7b 0d 09 09 09 09 09 | 09 09 65 72 72 20 3d 20 |.{......|..err = |
|000019a0| 46 53 57 72 69 74 65 28 | 72 65 66 4e 75 6d 2c 20 |FSWrite(|refNum, |
|000019b0| 26 77 72 69 74 65 53 69 | 7a 65 2c 20 7a 65 72 6f |&writeSi|ze, zero|
|000019c0| 73 29 3b 0d 09 09 09 09 | 09 09 09 44 69 73 70 6f |s);.....|...Dispo|
|000019d0| 73 65 50 74 72 28 7a 65 | 72 6f 73 29 3b 0d 09 09 |sePtr(ze|ros);...|
|000019e0| 09 09 09 09 09 69 66 28 | 65 72 72 20 3d 3d 20 6e |.....if(|err == n|
|000019f0| 6f 45 72 72 29 0d 09 09 | 09 09 09 09 09 7b 0d 09 |oErr)...|.....{..|
|00001a00| 09 09 09 09 09 09 09 2f | 2f 20 57 72 69 74 65 20 |......./|/ Write |
|00001a10| 6f 75 74 20 74 68 65 20 | 70 69 63 74 0d 09 09 09 |out the |pict....|
|00001a20| 09 09 09 09 09 77 72 69 | 74 65 53 69 7a 65 20 3d |.....wri|teSize =|
|00001a30| 20 47 65 74 48 61 6e 64 | 6c 65 53 69 7a 65 28 28 | GetHand|leSize((|
|00001a40| 48 61 6e 64 6c 65 29 6e | 65 77 50 69 63 74 29 3b |Handle)n|ewPict);|
|00001a50| 0d 09 09 09 09 09 09 09 | 09 48 4c 6f 63 6b 28 28 |........|.HLock((|
|00001a60| 48 61 6e 64 6c 65 29 6e | 65 77 50 69 63 74 29 3b |Handle)n|ewPict);|
|00001a70| 20 2f 2f 20 6e 65 65 64 | 65 64 3f 0d 09 09 09 09 | // need|ed?.....|
|00001a80| 09 09 09 09 65 72 72 20 | 3d 20 46 53 57 72 69 74 |....err |= FSWrit|
|00001a90| 65 28 72 65 66 4e 75 6d | 2c 20 26 77 72 69 74 65 |e(refNum|, &write|
|00001aa0| 53 69 7a 65 2c 20 2a 6e | 65 77 50 69 63 74 29 3b |Size, *n|ewPict);|
|00001ab0| 0d 09 09 09 09 09 09 09 | 7d 0d 09 09 09 09 09 09 |........|}.......|
|00001ac0| 7d 0d 09 09 09 09 09 09 | 65 6c 73 65 20 65 72 72 |}.......|else err|
|00001ad0| 20 3d 20 6d 65 6d 46 75 | 6c 6c 45 72 72 3b 0d 09 | = memFu|llErr;..|
|00001ae0| 09 09 09 09 09 46 53 43 | 6c 6f 73 65 28 72 65 66 |.....FSC|lose(ref|
|00001af0| 4e 75 6d 29 3b 0d 09 09 | 09 09 09 7d 0d 09 09 09 |Num);...|...}....|
|00001b00| 09 7d 0d 09 09 09 7d 0d | 09 09 7d 0d 09 7d 0d 09 |.}....}.|..}..}..|
|00001b10| 72 65 74 75 72 6e 20 65 | 72 72 3b 0d 7d 0d 0d 0d |return e|rr;.}...|
|00001b20| 2f 2f 20 74 68 69 73 20 | 69 73 20 74 68 65 20 63 |// this |is the c|
|00001b30| 75 73 74 6f 6d 20 62 69 | 74 73 20 70 72 6f 63 20 |ustom bi|ts proc |
|00001b40| 74 68 61 74 20 73 74 72 | 69 70 73 20 74 68 65 20 |that str|ips the |
|00001b50| 63 6f 6c 6f 72 20 74 61 | 62 6c 65 0d 70 61 73 63 |color ta|ble.pasc|
|00001b60| 61 6c 20 76 6f 69 64 20 | 53 74 72 69 70 43 6c 75 |al void |StripClu|
|00001b70| 74 50 72 6f 63 28 42 69 | 74 4d 61 70 20 2a 73 72 |tProc(Bi|tMap *sr|
|00001b80| 63 2c 20 0d 09 09 09 52 | 65 63 74 20 2a 73 72 63 |c, ....R|ect *src|
|00001b90| 52 2c 20 52 65 63 74 20 | 2a 64 73 74 52 2c 0d 09 |R, Rect |*dstR,..|
|00001ba0| 09 09 73 68 6f 72 74 20 | 6d 6f 64 65 2c 20 52 67 |..short |mode, Rg|
|00001bb0| 6e 48 61 6e 64 6c 65 20 | 6d 73 6b 29 20 0d 7b 0d |nHandle |msk) .{.|
|00001bc0| 09 43 54 61 62 48 61 6e | 64 6c 65 09 73 61 76 65 |.CTabHan|dle.save|
|00001bd0| 43 54 48 20 3d 20 6e 69 | 6c 3b 0d 09 0d 09 2f 2f |CTH = ni|l;....//|
|00001be0| 20 41 73 73 75 6d 65 20 | 74 68 65 72 65 27 73 20 | Assume |there's |
|00001bf0| 6e 6f 20 63 6c 75 74 20 | 74 6f 20 73 74 72 69 70 |no clut |to strip|
|00001c00| 0d 09 67 43 6c 75 74 53 | 74 72 69 70 70 65 64 20 |..gClutS|tripped |
|00001c10| 3d 20 66 61 6c 73 65 3b | 0d 09 0d 09 2f 2f 20 49 |= false;|....// I|
|00001c20| 66 20 69 74 27 73 20 61 | 20 50 69 78 4d 61 70 2e |f it's a| PixMap.|
|00001c30| 2e 2e 0d 09 69 66 28 73 | 72 63 2d 3e 72 6f 77 42 |....if(s|rc->rowB|
|00001c40| 79 74 65 73 20 26 20 30 | 78 38 30 30 30 29 0d 09 |ytes & 0|x8000)..|
|00001c50| 7b 0d 09 09 2f 2f 20 2e | 2e 2e 61 6e 64 20 69 74 |{...// .|..and it|
|00001c60| 27 73 20 69 6e 64 65 78 | 65 64 2e 2e 2e 0d 09 09 |'s index|ed......|
|00001c70| 69 66 28 28 28 50 69 78 | 4d 61 70 20 2a 29 73 72 |if(((Pix|Map *)sr|
|00001c80| 63 29 2d 3e 70 69 78 65 | 6c 53 69 7a 65 20 3c 20 |c)->pixe|lSize < |
|00001c90| 31 36 29 0d 09 09 7b 0d | 09 09 09 2f 2f 20 2e 2e |16)...{.|...// ..|
|00001ca0| 2e 73 61 76 65 20 63 6f | 6c 6f 72 20 74 61 62 6c |.save co|lor tabl|
|00001cb0| 65 20 68 61 6e 64 6c 65 | 20 61 6e 64 2e 2e 2e 0d |e handle| and....|
|00001cc0| 09 09 09 73 61 76 65 43 | 54 48 20 3d 20 28 28 50 |...saveC|TH = ((P|
|00001cd0| 69 78 4d 61 70 50 74 72 | 29 20 73 72 63 29 2d 3e |ixMapPtr|) src)->|
|00001ce0| 70 6d 54 61 62 6c 65 3b | 09 0d 09 09 09 2f 2f 20 |pmTable;|.....// |
|00001cf0| 2e 2e 2e 72 65 70 6c 61 | 63 65 20 69 74 20 77 69 |...repla|ce it wi|
|00001d00| 74 68 20 6e 69 6c 20 69 | 6e 73 74 65 61 64 2e 0d |th nil i|nstead..|
|00001d10| 09 09 09 28 28 50 69 78 | 4d 61 70 50 74 72 29 20 |...((Pix|MapPtr) |
|00001d20| 73 72 63 29 2d 3e 70 6d | 54 61 62 6c 65 20 3d 20 |src)->pm|Table = |
|00001d30| 6e 69 6c 3b 0d 09 09 09 | 2f 2f 20 54 65 6c 6c 20 |nil;....|// Tell |
|00001d40| 74 68 65 20 77 6f 72 6c | 64 20 77 68 61 74 20 77 |the worl|d what w|
|00001d50| 65 27 76 65 20 64 6f 6e | 65 0d 09 09 09 67 43 6c |e've don|e....gCl|
|00001d60| 75 74 53 74 72 69 70 70 | 65 64 20 3d 20 74 72 75 |utStripp|ed = tru|
|00001d70| 65 3b 0d 09 09 7d 0d 09 | 7d 0d 09 0d 09 2f 2f 20 |e;...}..|}....// |
|00001d80| 4c 65 74 20 51 75 69 63 | 6b 44 72 61 77 20 64 6f |Let Quic|kDraw do|
|00001d90| 20 74 68 65 20 77 6f 72 | 6b 2e 0d 09 53 74 64 42 | the wor|k...StdB|
|00001da0| 69 74 73 28 73 72 63 2c | 20 73 72 63 52 2c 20 64 |its(src,| srcR, d|
|00001db0| 73 74 52 2c 20 6d 6f 64 | 65 2c 20 6d 73 6b 29 3b |stR, mod|e, msk);|
|00001dc0| 0d 09 0d 09 2f 2f 20 52 | 65 73 74 6f 72 65 20 73 |....// R|estore s|
|00001dd0| 61 76 65 64 20 68 61 6e | 64 6c 65 20 69 66 20 6e |aved han|dle if n|
|00001de0| 65 63 65 73 73 61 72 79 | 2e 0d 09 69 66 28 73 61 |ecessary|...if(sa|
|00001df0| 76 65 43 54 48 20 21 3d | 20 6e 69 6c 29 0d 09 09 |veCTH !=| nil)...|
|00001e00| 28 28 50 69 78 4d 61 70 | 50 74 72 29 20 73 72 63 |((PixMap|Ptr) src|
|00001e10| 29 2d 3e 70 6d 54 61 62 | 6c 65 20 3d 20 73 61 76 |)->pmTab|le = sav|
|00001e20| 65 43 54 48 3b 0d 7d 0d | 0d 2f 2f 20 4d 6f 64 69 |eCTH;.}.|.// Modi|
|00001e30| 66 69 65 64 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 |fied ver|sion of |
|00001e40| 47 65 74 44 69 72 49 74 | 65 6d 73 20 66 72 6f 6d |GetDirIt|ems from|
|00001e50| 20 4d 6f 72 65 46 69 6c | 65 73 0d 70 61 73 63 61 | MoreFil|es.pasca|
|00001e60| 6c 09 4f 53 45 72 72 09 | 47 65 74 54 79 70 65 64 |l.OSErr.|GetTyped|
|00001e70| 46 69 6c 65 73 49 6e 44 | 69 72 28 0d 09 09 09 09 |FilesInD|ir(.....|
|00001e80| 09 09 09 73 68 6f 72 74 | 20 76 52 65 66 4e 75 6d |...short| vRefNum|
|00001e90| 2c 0d 09 09 09 09 09 09 | 09 6c 6f 6e 67 20 64 69 |,.......|.long di|
|00001ea0| 72 49 44 2c 0d 09 09 09 | 09 09 09 09 53 74 72 69 |rID,....|....Stri|
|00001eb0| 6e 67 50 74 72 20 6e 61 | 6d 65 2c 0d 09 09 09 09 |ngPtr na|me,.....|
|00001ec0| 09 09 09 4f 53 54 79 70 | 65 09 66 69 6c 65 54 79 |...OSTyp|e.fileTy|
|00001ed0| 70 65 2c 20 09 2f 2f 20 | 4f 6e 6c 79 20 72 65 74 |pe, .// |Only ret|
|00001ee0| 75 72 6e 20 66 69 6c 65 | 73 20 6f 66 20 74 68 69 |urn file|s of thi|
|00001ef0| 73 20 74 79 70 65 0d 09 | 09 09 09 09 09 09 46 53 |s type..|......FS|
|00001f00| 53 70 65 63 50 74 72 20 | 69 74 65 6d 73 2c 09 2f |SpecPtr |items,./|
|00001f10| 2f 20 41 72 72 61 79 20 | 6f 66 20 46 53 53 70 65 |/ Array |of FSSpe|
|00001f20| 63 73 20 74 6f 20 72 65 | 74 75 72 6e 20 69 74 65 |cs to re|turn ite|
|00001f30| 6d 73 0d 09 09 09 09 09 | 09 09 73 68 6f 72 74 20 |ms......|..short |
|00001f40| 72 65 71 49 74 65 6d 43 | 6f 75 6e 74 2c 09 2f 2f |reqItemC|ount,.//|
|00001f50| 20 4e 75 6d 62 65 72 20 | 6f 66 20 69 74 65 6d 73 | Number |of items|
|00001f60| 20 69 6e 20 61 72 72 61 | 79 0d 09 09 09 09 09 09 | in arra|y.......|
|00001f70| 09 73 68 6f 72 74 20 2a | 61 63 74 49 74 65 6d 43 |.short *|actItemC|
|00001f80| 6f 75 6e 74 2c 09 2f 2f | 20 41 63 74 75 61 6c 20 |ount,.//| Actual |
|00001f90| 6e 75 6d 62 65 72 20 72 | 65 74 75 72 6e 65 64 09 |number r|eturned.|
|00001fa0| 0d 09 09 09 09 09 09 09 | 73 68 6f 72 74 20 2a 69 |........|short *i|
|00001fb0| 74 65 6d 49 6e 64 65 78 | 29 09 2f 2f 20 73 74 61 |temIndex|).// sta|
|00001fc0| 72 74 20 77 69 74 68 20 | 31 2c 20 74 68 65 6e 20 |rt with |1, then |
|00001fd0| 75 73 65 20 77 68 61 74 | 27 73 20 72 65 74 75 72 |use what|'s retur|
|00001fe0| 6e 65 64 0d 7b 0d 09 43 | 49 6e 66 6f 50 42 52 65 |ned.{..C|InfoPBRe|
|00001ff0| 63 20 70 62 3b 0d 09 4f | 53 45 72 72 20 65 72 72 |c pb;..O|SErr err|
|00002000| 6f 72 20 3d 20 6e 6f 45 | 72 72 3b 0d 09 6c 6f 6e |or = noE|rr;..lon|
|00002010| 67 20 74 68 65 44 69 72 | 49 44 3b 0d 09 42 6f 6f |g theDir|ID;..Boo|
|00002020| 6c 65 61 6e 20 69 73 44 | 69 72 65 63 74 6f 72 79 |lean isD|irectory|
|00002030| 3b 0d 09 46 53 53 70 65 | 63 20 2a 65 6e 64 49 74 |;..FSSpe|c *endIt|
|00002040| 65 6d 73 41 72 72 61 79 | 20 3d 20 69 74 65 6d 73 |emsArray| = items|
|00002050| 20 2b 20 72 65 71 49 74 | 65 6d 43 6f 75 6e 74 3b | + reqIt|emCount;|
|00002060| 0d 0d 09 2f 2a 20 4e 4f | 54 45 3a 20 49 66 20 49 |.../* NO|TE: If I|
|00002070| 20 63 6f 75 6c 64 20 62 | 65 20 73 75 72 65 20 74 | could b|e sure t|
|00002080| 68 61 74 20 74 68 65 20 | 63 61 6c 6c 65 72 20 70 |hat the |caller p|
|00002090| 61 73 73 65 64 20 61 20 | 72 65 61 6c 20 76 52 65 |assed a |real vRe|
|000020a0| 66 4e 75 6d 20 61 6e 64 | 20 72 65 61 6c 20 64 69 |fNum and| real di|
|000020b0| 72 65 63 74 6f 72 79 20 | 2a 2f 0d 09 2f 2a 20 74 |rectory |*/../* t|
|000020c0| 6f 20 74 68 69 73 20 72 | 6f 75 74 69 6e 65 2c 20 |o this r|outine, |
|000020d0| 49 20 63 6f 75 6c 64 20 | 72 69 70 20 6f 75 74 20 |I could |rip out |
|000020e0| 63 61 6c 6c 73 20 74 6f | 20 44 65 74 65 72 6d 69 |calls to| Determi|
|000020f0| 6e 65 56 52 65 66 4e 75 | 6d 20 61 6e 64 20 47 65 |neVRefNu|m and Ge|
|00002100| 74 44 69 72 49 44 20 61 | 6e 64 20 74 68 69 73 20 |tDirID a|nd this |
|00002110| 2a 2f 0d 09 2f 2a 20 72 | 6f 75 74 69 6e 65 20 77 |*/../* r|outine w|
|00002120| 6f 75 6c 64 20 62 65 20 | 6d 75 63 68 20 66 61 73 |ould be |much fas|
|00002130| 74 65 72 20 62 65 63 61 | 75 73 65 20 6f 66 20 74 |ter beca|use of t|
|00002140| 68 65 20 6f 76 65 72 68 | 65 61 64 20 6f 66 20 44 |he overh|ead of D|
|00002150| 65 74 65 72 6d 69 6e 65 | 56 52 65 66 4e 75 6d 20 |etermine|VRefNum |
|00002160| 61 6e 64 20 2a 2f 0d 09 | 2f 2a 20 47 65 74 44 69 |and */..|/* GetDi|
|00002170| 72 49 44 20 61 6e 64 20 | 62 65 63 61 75 73 65 20 |rID and |because |
|00002180| 47 65 74 44 69 72 49 44 | 20 62 6c 6f 77 73 20 61 |GetDirID| blows a|
|00002190| 77 61 79 20 74 68 65 20 | 64 69 72 65 63 74 6f 72 |way the |director|
|000021a0| 79 20 69 6e 64 65 78 20 | 68 69 6e 74 20 74 68 65 |y index |hint the|
|000021b0| 20 4d 61 63 69 6e 74 6f | 73 68 20 2a 2f 0d 09 2f | Macinto|sh */../|
|000021c0| 2a 20 66 69 6c 65 20 73 | 79 73 74 65 6d 20 6b 65 |* file s|ystem ke|
|000021d0| 65 70 73 20 66 6f 72 20 | 69 6e 64 65 78 65 64 20 |eps for |indexed |
|000021e0| 63 61 6c 6c 73 2e 20 49 | 20 63 61 6e 27 74 20 62 |calls. I| can't b|
|000021f0| 65 20 73 75 72 65 2c 20 | 73 6f 20 66 6f 72 20 6d |e sure, |so for m|
|00002200| 61 78 69 6d 75 6d 20 74 | 68 72 6f 75 67 68 70 75 |aximum t|hroughpu|
|00002210| 74 2c 20 2a 2f 0d 09 2f | 2a 20 70 61 73 73 20 61 |t, */../|* pass a|
|00002220| 20 62 69 67 20 61 72 72 | 61 79 20 6f 66 20 46 53 | big arr|ay of FS|
|00002230| 53 70 65 63 73 20 73 6f | 20 79 6f 75 20 63 61 6e |Specs so| you can|
|00002240| 20 67 65 74 20 74 68 65 | 20 64 69 72 65 63 74 6f | get the| directo|
|00002250| 72 79 27 73 20 63 6f 6e | 74 65 6e 74 73 20 77 69 |ry's con|tents wi|
|00002260| 74 68 20 66 65 77 20 63 | 61 6c 6c 73 20 2a 2f 0d |th few c|alls */.|
|00002270| 09 2f 2a 20 74 6f 20 74 | 68 69 73 20 72 6f 75 74 |./* to t|his rout|
|00002280| 69 6e 65 2e 20 2a 2f 0d | 09 0d 09 2f 2a 20 67 65 |ine. */.|.../* ge|
|00002290| 74 20 74 68 65 20 72 65 | 61 6c 20 76 6f 6c 75 6d |t the re|al volum|
|000022a0| 65 20 72 65 66 65 72 65 | 6e 63 65 20 6e 75 6d 62 |e refere|nce numb|
|000022b0| 65 72 20 2a 2f 0d 09 65 | 72 72 6f 72 20 3d 20 44 |er */..e|rror = D|
|000022c0| 65 74 65 72 6d 69 6e 65 | 56 52 65 66 4e 75 6d 28 |etermine|VRefNum(|
|000022d0| 6e 61 6d 65 2c 20 76 52 | 65 66 4e 75 6d 2c 20 26 |name, vR|efNum, &|
|000022e0| 70 62 2e 68 46 69 6c 65 | 49 6e 66 6f 2e 69 6f 56 |pb.hFile|Info.ioV|
|000022f0| 52 65 66 4e 75 6d 29 3b | 0d 09 69 66 20 28 20 65 |RefNum);|..if ( e|
|00002300| 72 72 6f 72 20 21 3d 20 | 6e 6f 45 72 72 20 29 0d |rror != |noErr ).|
|00002310| 09 09 72 65 74 75 72 6e | 20 28 20 65 72 72 6f 72 |..return| ( error|
|00002320| 20 29 3b 0d 09 0d 09 2f | 2a 20 61 6e 64 20 74 68 | );..../|* and th|
|00002330| 65 20 72 65 61 6c 20 64 | 69 72 65 63 74 6f 72 79 |e real d|irectory|
|00002340| 20 49 44 20 6f 66 20 74 | 68 69 73 20 64 69 72 65 | ID of t|his dire|
|00002350| 63 74 6f 72 79 20 28 61 | 6e 64 20 6d 61 6b 65 20 |ctory (a|nd make |
|00002360| 73 75 72 65 20 69 74 20 | 49 53 20 61 20 64 69 72 |sure it |IS a dir|
|00002370| 65 63 74 6f 72 79 29 20 | 2a 2f 0d 09 65 72 72 6f |ectory) |*/..erro|
|00002380| 72 20 3d 20 47 65 74 44 | 69 72 49 44 28 76 52 65 |r = GetD|irID(vRe|
|00002390| 66 4e 75 6d 2c 20 64 69 | 72 49 44 2c 20 6e 61 6d |fNum, di|rID, nam|
|000023a0| 65 2c 20 26 74 68 65 44 | 69 72 49 44 2c 20 26 69 |e, &theD|irID, &i|
|000023b0| 73 44 69 72 65 63 74 6f | 72 79 29 3b 0d 09 69 66 |sDirecto|ry);..if|
|000023c0| 20 28 20 65 72 72 6f 72 | 20 21 3d 20 6e 6f 45 72 | ( error| != noEr|
|000023d0| 72 20 29 0d 09 09 72 65 | 74 75 72 6e 20 28 20 65 |r )...re|turn ( e|
|000023e0| 72 72 6f 72 20 29 3b 0d | 09 65 6c 73 65 20 69 66 |rror );.|.else if|
|000023f0| 20 28 20 21 69 73 44 69 | 72 65 63 74 6f 72 79 20 | ( !isDi|rectory |
|00002400| 29 0d 09 09 72 65 74 75 | 72 6e 20 28 20 64 69 72 |)...retu|rn ( dir|
|00002410| 4e 46 45 72 72 20 29 3b | 0d 0d 0d 09 2a 61 63 74 |NFErr );|....*act|
|00002420| 49 74 65 6d 43 6f 75 6e | 74 20 3d 20 30 3b 0d 09 |ItemCoun|t = 0;..|
|00002430| 66 6f 72 20 28 20 3b 20 | 28 69 74 65 6d 73 20 3c |for ( ; |(items <|
|00002440| 20 65 6e 64 49 74 65 6d | 73 41 72 72 61 79 29 20 | endItem|sArray) |
|00002450| 26 26 20 28 65 72 72 6f | 72 20 3d 3d 20 6e 6f 45 |&& (erro|r == noE|
|00002460| 72 72 29 3b 20 29 0d 09 | 7b 0d 09 09 70 62 2e 68 |rr); )..|{...pb.h|
|00002470| 46 69 6c 65 49 6e 66 6f | 2e 69 6f 4e 61 6d 65 50 |FileInfo|.ioNameP|
|00002480| 74 72 20 3d 20 28 53 74 | 72 69 6e 67 50 74 72 29 |tr = (St|ringPtr)|
|00002490| 20 26 69 74 65 6d 73 2d | 3e 6e 61 6d 65 3b 0d 09 | &items-|>name;..|
|000024a0| 09 70 62 2e 68 46 69 6c | 65 49 6e 66 6f 2e 69 6f |.pb.hFil|eInfo.io|
|000024b0| 44 69 72 49 44 20 3d 20 | 74 68 65 44 69 72 49 44 |DirID = |theDirID|
|000024c0| 3b 0d 09 09 70 62 2e 68 | 46 69 6c 65 49 6e 66 6f |;...pb.h|FileInfo|
|000024d0| 2e 69 6f 46 44 69 72 49 | 6e 64 65 78 20 3d 20 2a |.ioFDirI|ndex = *|
|000024e0| 69 74 65 6d 49 6e 64 65 | 78 3b 0d 09 09 65 72 72 |itemInde|x;...err|
|000024f0| 6f 72 20 3d 20 50 42 47 | 65 74 43 61 74 49 6e 66 |or = PBG|etCatInf|
|00002500| 6f 53 79 6e 63 28 26 70 | 62 29 3b 0d 09 09 69 66 |oSync(&p|b);...if|
|00002510| 20 28 20 65 72 72 6f 72 | 20 3d 3d 20 6e 6f 45 72 | ( error| == noEr|
|00002520| 72 20 29 0d 09 09 7b 0d | 09 09 09 69 74 65 6d 73 |r )...{.|...items|
|00002530| 2d 3e 70 61 72 49 44 20 | 3d 20 70 62 2e 68 46 69 |->parID |= pb.hFi|
|00002540| 6c 65 49 6e 66 6f 2e 69 | 6f 46 6c 50 61 72 49 44 |leInfo.i|oFlParID|
|00002550| 3b 09 2f 2a 20 72 65 74 | 75 72 6e 20 69 74 65 6d |;./* ret|urn item|
|00002560| 27 73 20 70 61 72 49 44 | 20 2a 2f 0d 09 09 09 69 |'s parID| */....i|
|00002570| 74 65 6d 73 2d 3e 76 52 | 65 66 4e 75 6d 20 3d 20 |tems->vR|efNum = |
|00002580| 70 62 2e 68 46 69 6c 65 | 49 6e 66 6f 2e 69 6f 56 |pb.hFile|Info.ioV|
|00002590| 52 65 66 4e 75 6d 3b 09 | 2f 2a 20 72 65 74 75 72 |RefNum;.|/* retur|
|000025a0| 6e 20 69 74 65 6d 27 73 | 20 76 52 65 66 4e 75 6d |n item's| vRefNum|
|000025b0| 20 2a 2f 0d 09 09 09 2b | 2b 2a 69 74 65 6d 49 6e | */....+|+*itemIn|
|000025c0| 64 65 78 3b 09 2f 2a 20 | 70 72 65 70 61 72 65 20 |dex;./* |prepare |
|000025d0| 74 6f 20 67 65 74 20 6e | 65 78 74 20 69 74 65 6d |to get n|ext item|
|000025e0| 20 69 6e 20 64 69 72 65 | 63 74 6f 72 79 20 2a 2f | in dire|ctory */|
|000025f0| 0d 09 09 09 0d 09 09 09 | 69 66 20 28 20 28 70 62 |........|if ( (pb|
|00002600| 2e 68 46 69 6c 65 49 6e | 66 6f 2e 69 6f 46 6c 41 |.hFileIn|fo.ioFlA|
|00002610| 74 74 72 69 62 20 26 20 | 69 6f 44 69 72 4d 61 73 |ttrib & |ioDirMas|
|00002620| 6b 29 20 3d 3d 20 30 20 | 29 0d 09 09 09 7b 0d 09 |k) == 0 |)....{..|
|00002630| 09 09 09 69 66 28 70 62 | 2e 68 46 69 6c 65 49 6e |...if(pb|.hFileIn|
|00002640| 66 6f 2e 69 6f 46 6c 46 | 6e 64 72 49 6e 66 6f 2e |fo.ioFlF|ndrInfo.|
|00002650| 66 64 54 79 70 65 20 3d | 3d 20 66 69 6c 65 54 79 |fdType =|= fileTy|
|00002660| 70 65 29 0d 09 09 09 09 | 7b 0d 09 09 09 09 09 2b |pe).....|{......+|
|00002670| 2b 2a 61 63 74 49 74 65 | 6d 43 6f 75 6e 74 3b 20 |+*actIte|mCount; |
|00002680| 2f 2a 20 6b 65 65 70 20 | 74 68 69 73 20 69 74 65 |/* keep |this ite|
|00002690| 6d 20 2a 2f 0d 09 09 09 | 09 09 2b 2b 69 74 65 6d |m */....|..++item|
|000026a0| 73 3b 20 2f 2a 20 70 6f | 69 6e 74 20 74 6f 20 6e |s; /* po|int to n|
|000026b0| 65 78 74 20 69 74 65 6d | 20 2a 2f 0d 09 09 09 09 |ext item| */.....|
|000026c0| 7d 0d 09 09 09 7d 0d 09 | 09 7d 0d 09 7d 0d 09 72 |}....}..|.}..}..r|
|000026d0| 65 74 75 72 6e 20 28 20 | 65 72 72 6f 72 20 29 3b |eturn ( |error );|
|000026e0| 0d 7d 0d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.}......|........|
|000026f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002700| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00002710| a7 9d 50 0d 00 00 00 1d | 00 00 00 00 00 08 aa 19 |..P.....|........|
|00002720| ef 9e 00 00 51 2b 00 00 | 00 79 00 09 aa 19 ef 9e |....Q+..|.y......|
|00002730| 0c 42 61 74 63 68 43 4c | 55 54 73 2e 63 3b 02 00 |.BatchCL|UTs.c;..|
|00002740| 00 00 54 45 58 54 4d 4d | 43 43 01 00 00 00 01 0b |..TEXTMM|CC......|
|00002750| 00 00 54 45 58 54 4d 4d | 43 43 01 00 00 00 01 0b |..TEXTMM|CC......|
|00002760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002770| 00 00 aa 8a 03 6c 00 00 | 26 63 00 00 01 7e 00 09 |.....l..|&c...~..|
|00002780| a8 b3 60 42 00 00 26 56 | 00 00 00 97 00 09 a7 25 |..`B..&V|.......%|
|00002790| 87 4c 00 00 00 8c 00 00 | 00 f6 00 08 a9 ab 20 14 |.L......|...... .|
|000027a0| 00 00 42 b7 00 00 01 8a | 00 08 aa 1e 1d 19 00 00 |..B.....|........|
|000027b0| 54 c2 00 00 00 23 00 09 | a7 9d 52 b7 00 00 0b b8 |T....#..|..R.....|
|000027c0| 00 00 00 04 00 09 a8 b3 | 60 42 00 00 26 5d 00 00 |........|`B..&]..|
|000027d0| 00 97 00 09 a8 b3 60 4d | 00 00 26 d3 00 00 00 97 |......`M|..&.....|
|000027e0| 00 09 a7 25 87 4f 00 00 | 00 86 00 00 01 b4 00 08 |...%.O..|........|
|000027f0| aa 19 ef a4 00 00 51 35 | 00 00 00 77 00 09 a7 9d |......Q5|...w....|
|00002800| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00002810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002820| 00 00 00 00 00 00 00 03 | 00 04 fe b2 02 85 01 fa |........|........|
|00002830| 04 9b fe b2 02 85 01 fa | 04 9b aa c4 64 a0 00 00 |........|....d...|
|00002840| 0b 89 00 00 0b 89 00 00 | 0b 7f 01 00 00 00 01 00 |........|........|
|00002850| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 ef 1c e4 |...L...L|...2....|
|00002860| 1a 14 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|00002870| 00 0a 03 ed ff ff 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+